﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ERP_RORZE_PRODUCT.Product.DAO;

namespace ERP_RORZE_PRODUCT.Product.Incauhinh
{
    public partial class frm_KHCTEdit : DevExpress.XtraEditors.XtraForm
    {
        public event EventHandler Reload;
        ClsIncauhinhDAO clsConfigureDAO = new ClsIncauhinhDAO();

        public string KH;
        public string TenKH;
        public string MaKH;

        public frm_KHCTEdit()
        {
            InitializeComponent();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (txtKH.Text == "")
            {
                MessageBox.Show("chưa nhập mã kí hiệu");
            }
            else
            {
                clsConfigureDAO.UpdateKHCT(txtKH.Text, txtTenKH.Text, cbMaKH.Text);
                MessageBox.Show("Đã nhập xong");
                Reload(sender, e);
            }
        }

        private void frm_KHCTEdit_Load(object sender, EventArgs e)
        {
            DataTable dt;
            dt = clsConfigureDAO.GetAllCustomer();
            cbMaKH.DataSource = dt;
            cbMaKH.DisplayMember = "CustomerID";

            txtKH.Text = KH;
            txtTenKH.Text = TenKH;
            cbMaKH.SelectedText = MaKH;
        }
    }
}